package cn.itcast.scala.course05

/**
  * create by zhangtian on 2019/1/8
  */
object OptionApp {
  def main(args: Array[String]): Unit = {
    val m = Map(1->"Hello")

    /*println(m(1))
    println(m(2))*/

    println(m.get(1))
    println(m.get(2))

    println(m.getOrElse(2, "NONO"))
    Option
  }
}

/**
  * case object None extends Option[Nothing] {
  *   def isEmpty = true
  *   def get = throw new NoSuchElementException("None.get")
  * }
  *
  * final case class Some[+A](@deprecatedName('x, "2.12.0") value: A) extends Option[A] {
  *   def isEmpty = false
  *   def get = value
  * }
  */
